@extends('layouts.admin.application')

@section('css')
    <link rel="stylesheet" href="/vendor/daterangepicker/daterangepicker.css">
@endsection

@section('content')

    <div class="admin-content">

        <div class="am-cf am-padding">
            <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">编辑年卡</strong> /
                <small>Edit</small>
            </div>
        </div>
        <hr>
        @include('admin._flash')

        <div class="am-g">
            <div class="am-u-sm-12 am-u-md-12">

                <form class="am-form" action="/admin/member/{{$item->id}}" method="post">
                    {{ csrf_field() }}
                    {{ method_field('PUT') }}


                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            所属门店
                        </div>
                        <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                            <select  data-am-selected="{btnWidth: '100%',  btnStyle: 'secondary', btnSize: 'sm', maxHeight: 360, searchBox: 1}"
                                     name="store_id">
                                <option value="">请选择</option>
                                @foreach($cates as $c)
                                    <option value="{{$c->id}}" @if($c->id==$item->store_id) selected @endif>{{$c->name}}</option>
                                @endforeach
                            </select>
                        </div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            名称
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <input type="text" class="am-input-sm" name="name"  value="{{$item->name}}">
                        </div>
                        <div class="am-hide-sm-only am-u-md-6"></div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            原价
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <input type="text" class="am-input-sm" name="price" value="{{$item->price}}" >
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">*如99元则填写99</div>
                    </div>
                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            活动价
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <input type="text" class="am-input-sm" name="active_price" value="{{$item->active_price}}" >
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">*如99元则填写99</div>
                    </div>

                    <div class="am-g am-margin-top sort">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            描述信息
                        </div>
                        <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                            <textarea rows="3" name="about"  value="" placeholder="">{{$item->about}}</textarea>
                        </div>
                    </div>

                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            月数
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <input type="text" class="am-input-sm" name="month" value="{{$item->month}}" >
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">*如6月则填写6</div>
                    </div>

                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                           可暂停次数
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <input type="text" class="am-input-sm" name="stop_time" value="{{$item->stop_time}}" >
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">*如3次则填写3</div>
                    </div>

                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            暂停最大天数
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <input type="text" class="am-input-sm" name="can_stop_maxday" value="{{$item->can_stop_maxday}}" >
                        </div>
                        <div class="am-hide-sm-only am-u-md-6">*如15天则填写15</div>
                    </div>


                    <div class="am-g am-margin-top">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            排序
                        </div>
                        <div class="am-u-sm-8 am-u-md-4">
                            <input type="text" class="am-input-sm" name="sort" value="{{$item->sort}}" >
                        </div>
                        <div class="am-hide-sm-only am-u-md-6"></div>
                    </div>

                    <div class="am-g am-margin-top sort">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            是否使用
                        </div>


                        <span class="am-btn am-btn-default am-btn-xxs am-round">
                                        <input type="radio" name="is_use" value="1" @if($item->is_use==1)checked @endif   > 是
                                    </span>
                        <span class="am-btn am-btn-default am-btn-xxs am-round">
                                        <input type="radio" name="is_use" value="0"  @if($item->is_use==0)checked @endif >否
                                    </span>
                    </div>


                    <div class="am-g am-margin-top sort">
                        <div class="am-u-sm-4 am-u-md-2 am-text-right">
                            是否参与活动
                        </div>


                        <span class="am-btn am-btn-default am-btn-xxs am-round">
                                        <input type="radio" name="is_active" value="1"   @if($item->is_active==1)checked @endif  > 是
                                    </span>
                        <span class="am-btn am-btn-default am-btn-xxs am-round">
                                        <input type="radio" name="is_active" value="0" @if($item->is_active==0)checked @endif >否
                                    </span>
                    </div>






                    <div class="am-margin">
                        <button type="submit" class="am-btn am-btn-primary am-radius">提交保存</button>
                    </div>
                </form>
            </div>
        </div>
    </div>


@endsection
@section('js')
    <script src="/vendor/daterangepicker/moment.js"></script>
    <script src="/vendor/moment/locale/zh-cn.js"></script>
    <script src="/vendor/daterangepicker/daterangepicker.js"></script>

    <script>
        $(function () {
            //时间插件
            $('#date_start').daterangepicker({

                "autoUpdateInput": false,
                "autoApply": true,
                "locale": {
                    "format": "YYYY-MM-DD",
                    "applyLabel": "确定",
                    "cancelLabel": "取消"
                }
            }, function (start, end, label) {
                this.element[0].value = start.format('YYYY-MM-DD') + ' ~ ' + end.format('YYYY-MM-DD');
            });
        });

    </script>
@endsection